#!/bin/bash
echo "Starting  server......"

limit_in_bytes=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
if [ "$limit_in_bytes" -ne "9223372036854771712" -a "$limit_in_bytes" -ne "9223372036854775807" ]
then
    limit_in_megabytes=$(expr $limit_in_bytes \/ 1048576)
    heap_size=$(expr $limit_in_megabytes \* 4 \/ 5)
    export JAVA_OPTS="-Xmx${heap_size}m $JAVA_OPTS"
    echo JAVA_OPTS=$JAVA_OPTS
fi

java $JAVA_OPTS -jar -Xms256M -Xmx256M -XX:PermSize=16M -XX:MaxPermSize=128M -Xss512k factdata-sync.jar &
java $JAVA_OPTS -jar -Xms256M -Xmx256M -XX:PermSize=16M -XX:MaxPermSize=128M -Xss512k site-sequence.jar
## 死循环，保持docker前台运行
#while [[ true ]]; do
#    sleep 1
#done

